<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>v-model 结合单选按钮使用</title>
</head>
<body>
<div id="app">
    <form action="" method="get">
        <!--name 属性实现 单选按钮的分组，同一组的单选按钮互斥-->
        <!--value 属性实现设置提交到服务器的值-->
        <label for="male"><input type="radio" name="gender" id="male" value="male" v-model="gender"> 男</label>
        <label for="female"><input type="radio" name="gender" id="female" value="female" v-model="gender">女</label>

        <br>

        <input type="reset" value="重置" v-on:click="resetValue">
        <input type="submit" value="提交">
    </form>

    <h2>您选中的性别是：{{ gender }}</h2>
</div>

<script type="module">
    import {createApp, ref} from "../../../js/vue.esm-browser.js";

    let app = createApp(
        {
            setup() {
                let gender = ref(null)

                function resetValue() {
                    gender.value = null
                }

                return {
                    gender, resetValue,
                }
            }
        }
    );

    app.mount("#app")
</script>
</body>
</html>